package algo;

import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

public class CompletableFutureDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Arrays.asList(1, 2, 3).stream().map(i -> "hello" + i).forEach(s -> {
            System.out.println(s);
        });

        CompletableFuture<Void> taskA = CompletableFuture.runAsync(() -> System.out.println("A"))
                .thenRun(() -> System.out.println("B")).thenRun(() -> System.out.println("C"));


        taskA.get();
    }
}
